package com.zqq.convenientbanner.banner.holder;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.request.RequestOptions;
import com.zqq.convenientbanner.R;


/**
 * --by zqq on 2018/6/26
 */
public class LocalImageHolderView implements Holder<String> {

    private ImageView imageView;

    @Override
    public View createView(Context context) {
        View view = LayoutInflater.from(context).inflate(R.layout.item_localimage, null);
        imageView = view.findViewById(R.id.ivPost);
        return view;
    }

    @Override
    public void UpdateUI(Context context, int position, String data) {
        RequestOptions options = new RequestOptions()
                .placeholder(R.mipmap.blank_pic)
                .error(R.mipmap.img_error);


        Glide.with(context)
                .load(data)
                .apply(options)
//                .placeholder(R.drawable.blank_pic)
//                .error(R.mipmap.btn_nav_cart_normal)
                .into(imageView);
    }

}
